package com.zzedu.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzedu.common.utils.StringUtils;
import com.zzedu.domain.ZzAgentGrade;
import com.zzedu.dto.AgentGradeDTO;
import com.zzedu.mapper.ZzAgentGradeMapper;
import com.zzedu.service.IZzAgentGradeService;
import org.springframework.stereotype.Service;
/**
 * 代理商等级Service业务层处理
 * 
 * @author Mr.Wang
 * @date 2025-01-12
 */
@Service
public class ZzZzAgentGradeServiceImpl extends ServiceImpl<ZzAgentGradeMapper, ZzAgentGrade> implements IZzAgentGradeService
{

    @Override
    public LambdaQueryWrapper<ZzAgentGrade> buildQuery(AgentGradeDTO agentGrade) {
        LambdaQueryWrapper<ZzAgentGrade> lambdaQueryWrapper = Wrappers.lambdaQuery();
        lambdaQueryWrapper.like(StringUtils.isNotBlank(agentGrade.getGradeName()), ZzAgentGrade::getGradeName, agentGrade.getGradeName());
        lambdaQueryWrapper.eq(StringUtils.isNotBlank(agentGrade.getGradeCode()), ZzAgentGrade::getGradeCode, agentGrade.getGradeCode());

        lambdaQueryWrapper.orderByDesc(ZzAgentGrade::getId);
        return lambdaQueryWrapper;
    }
}